// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ActivationEventArgs.cs" company="Open Trader">
//   Copyright (c) David Denis (david.denis@systemathics.com)
// </copyright>
// <summary>
//   |  Open Trader - The Open Source Systematic Trading Platform
//   |
//   |  This program is free software: you can redistribute it and/or modify
//   |  it under the terms of the GNU General Public License as published by
//   |  the Free Software Foundation, either version 2 of the License, or
//   |  (at your option) any later version.
//   |
//   |  This program is distributed in the hope that it will be useful,
//   |  but WITHOUT ANY WARRANTY; without even the implied warranty of
//   |  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   |  GNU General Public License for more details.
//   |
//   |  You should have received a copy of the GNU General Public License
//   |  along with this program.  If not, see http://www.gnu.org/licenses
//   |
//   |  Up to date informations about Open Trader can be found at :
//   |    http://opentrader.org
//   |    http://opentrader.codeplex.com
//   |
//   |  For professional services, please visit us at :
//   |    http://www.systemathics.com
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Org.OpenTrader.Framework.Events
{
    #region Using Directives

    using System;

    using Org.OpenTrader.Framework.Enums;
    using Org.OpenTrader.Framework.LiveObjects.Interfaces;

    #endregion

    /// <summary>
    /// The activation context event args.
    /// </summary>
    [Serializable]
    public class ActivationEventArgs : EventArgs
    {
        #region Constants and Fields

        /// <summary>
        /// The type.
        /// </summary>
        private readonly EActivationType type;

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ActivationEventArgs"/> class. 
        /// Initializes a new instance of the <see cref="OtActivationEventArgs"/> class.
        /// </summary>
        /// <param name="type">
        /// The type.
        /// </param>
        protected ActivationEventArgs(EActivationType type)
        {
            this.type = type;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets Type.
        /// </summary>
        public EActivationType Type
        {
            get
            {
                return this.type;
            }
        }

        #endregion

        /// <summary>
        /// The create destroy activation context event args.
        /// </summary>
        [Serializable]
        public class CreateDestroy : ActivationEventArgs
        {
            #region Constructors and Destructors

            /// <summary>
            /// Initializes a new instance of the <see cref="CreateDestroy"/> class. 
            /// Initializes a new instance of the <see cref="CreateDestroyactivationArgsEventArgs"/> class.
            /// </summary>
            /// <param name="type">
            /// The type.
            /// </param>
            public CreateDestroy(EActivationType type)
                : base(type)
            {
            }

            #endregion
        }

        /// <summary>
        /// The plugin create destroy activation context event args.
        /// </summary>
        [Serializable]
        public class OwnedPluginCreateDestroy : ActivationEventArgs
        {
            #region Constants and Fields

            /// <summary>
            /// The plugin.
            /// </summary>
            private readonly IPlugin plugin;

            #endregion

            #region Constructors and Destructors

            /// <summary>
            /// Initializes a new instance of the <see cref="OwnedPluginCreateDestroy"/> class. 
            /// Initializes a new instance of the <see cref="PluginCreateDestroyactivationArgsEventArgs"/> class.
            /// </summary>
            /// <param name="type">
            /// The type.
            /// </param>
            /// <param name="plugin">
            /// The plugin.
            /// </param>
            public OwnedPluginCreateDestroy(EActivationType type, IPlugin plugin)
                : base(type)
            {
                this.plugin = plugin;
            }

            #endregion

            #region Properties

            /// <summary>
            /// Gets Plugin.
            /// </summary>
            public IPlugin Plugin
            {
                get
                {
                    return this.plugin;
                }
            }

            #endregion
        }

        /// <summary>
        /// The service create destroy activation context event args.
        /// </summary>
        [Serializable]
        public class OwnedServiceCreateDestroy : ActivationEventArgs
        {
            #region Constants and Fields

            /// <summary>
            /// The service.
            /// </summary>
            private readonly IService service;

            #endregion

            #region Constructors and Destructors

            /// <summary>
            /// Initializes a new instance of the <see cref="OwnedServiceCreateDestroy"/> class. 
            /// Initializes a new instance of the <see cref="ServiceCreateDestroyactivationArgsEventArgs"/> class.
            /// </summary>
            /// <param name="type">
            /// The type.
            /// </param>
            /// <param name="service">
            /// The service.
            /// </param>
            public OwnedServiceCreateDestroy(EActivationType type, IService service)
                : base(type)
            {
                this.service = service;
            }

            #endregion

            #region Properties

            /// <summary>
            /// Gets Service.
            /// </summary>
            public IService Service
            {
                get
                {
                    return this.service;
                }
            }

            #endregion
        }
    }
}